package com.sh.stream流;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

/**
 * @Auther: sh
 * @Version 1.0
 * @Description:
 */
public class StreamDemo2 {
    public static void main(String[] args) {
        List<String> nameList = new ArrayList<>();
        nameList.add("张三");
        nameList.add("张无忌");
        nameList.add("李四");
        nameList.stream().filter(name->name.startsWith("张")).forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        });
    }
}

